import AxiosHttp from "../utlis/http";
let sendUserCode = (data) => AxiosHttp('/api/front/sendCode', 'post', data, {
    'content-type': 'application/x-www-form-urlencoded'
})

let userLogin = (data) => AxiosHttp('/api/front/login/mobile', 'post', data)
// 收藏商品
let userClolet = (data) => AxiosHttp(`/api/front/collect/add`, 'post', data);
//取消收藏
let RemoveClolet = (id) => AxiosHttp(`/api/front/collect/cancel/${id}`, 'post');
// 用户下单
let userPreOrder = (data) => AxiosHttp(`/api/front/order/pre/order`, 'post', data);

// 获取订单信息
let getOrderInfo = (id) => AxiosHttp(`/api/front/order/load/pre/${id}`, 'get');

//创建支付订单
let createOrder = (data) => AxiosHttp(`/api/front/order/create`, "post", data);
//支付订单
let payOrder = (data) => AxiosHttp(`/api/front/pay/payment`, 'post', data);

// 获取用户信息
let getUserInfo = () => AxiosHttp(`/api/front/user`, 'get')
// 上传头像
let uploadUserImg = (data) => AxiosHttp(`/api/front/upload/image?model=maintain&pid=0`, "post", data)
// 保存修改用户信息
let saveUser = (data) => AxiosHttp(`/api/front/user/edit`, "post", data)
export {
    sendUserCode,
    userLogin,
    userClolet,
    RemoveClolet,
    userPreOrder,
    getOrderInfo,
    createOrder,
    payOrder,
    getUserInfo,
    uploadUserImg,
    saveUser
}